//: Playground - noun: a place where people can play

import UIKit

var str = "Hello, playground"

let array1 = ["a","b","c",123]

//array1.append("sss")
array1[1]

array1

let array2:Array = ["s"]
var arrayM3:Array = Array<String>()
var arrayM4 = [NSObject]()

//add

arrayM4.append("sss")
arrayM4.append("sss")
arrayM4.append("aaa")
arrayM4.append("ggg")

print(arrayM4)

//remove

//arrayM4.removeAll()

arrayM4.removeLast()
arrayM4.removeAtIndex(2)

//udate

arrayM4[1]="OOXX"
//遍历

arrayM4.append("sss")
arrayM4.append("sss")
arrayM4.append("aaa")
arrayM4.append("ggg")
arrayM4.append("sss")
arrayM4.append("sss")
arrayM4.append("aaa")
arrayM4.append("ggg")

for obj in  arrayM4{
print(obj)
}

for obj in  arrayM4[0..<2]{
    print(obj)
}

for obj in  arrayM4[0...2]{
    print(obj)
}
//取
arrayM4[3]


//合并

//直接合并数组中的数据类型必须一致
//let arrayL = array1 + arrayM4[0..<1]
var arrayLast = [" "]


//注意泛型的类型
for value in array1{
arrayM4.append(value)
}







